package com.vichat.user.service;

import com.vichat.common.enums.RecordType;
import com.vichat.common.exception.ViChatException;
import com.vichat.common.vo.PageFilter;
import com.vichat.user.entity.*;
import com.vichat.user.vo.AgentUseVO;
import com.vichat.user.vo.AgentUserOnlineVO;
import com.vichat.user.vo.CcsUserOnlineVO;

import java.util.List;
import java.util.Map;

/**
 * Created by wangluyin on 16/9/17.
 */
public interface IUserCcsService {
    public List<CcsUser> queryCcsUser(CcsUser ccsUser, PageFilter pf);
    public long countCcsUser(CcsUser ccsUser);

    /**
     * 增加子账号
     *
     * @param user
     * @return
     */
    public UserBasic saveUserBasicCcs(UserBasic user) throws Exception;

    List<UserPartyCompany> queryUserCompanyCCS(UserPartyCompany company, UserBasic user, PageFilter pf, boolean isPrecision) throws Exception;

    public Long countUserCompanyCCS(UserPartyCompany company, UserBasic user,boolean isPrecision) throws Exception;

    public void saveUserPartyCompany(UserPartyCompany company);

    /**
     * 客服修改密码
     *
     * @param uid
     * @param newPassWord
     */
    public UserBasic ccsChgUserPass(long uid, String newPassWord);

    /**
     * 批量导入客户
     *
     * @param users
     * @return
     */
    public Map<String, List<UserBasic>> batchCreateUser(List<UserBasic> users);

    /**
     * 批量更新客户信息
     *
     * @param users
     * @return
     */
    public Map<String, List<UserBasic>> batchUpdateUser(List<UserBasic> users);

    /**
     * 获取客服用户信息
     *
     * @param uid
     * @return
     */
    public CcsUser getCcsUserInfoById(long uid);

    /**
     * 获取客服用户信息
     *
     * @param account
     * @return
     */
    public CcsUser getCcsUserInfoByAccount(String account);

    /**
     * 保存操作日志
     *
     * @param user
     * @param type
     * @param opedUid
     * @param opedUserName
     * @param opedInfo
     * @param remark
     * @throws Exception
     */
    public void saveSysCcsBusiRecord(CcsUser user, RecordType type, long opedUid, String opedUserName, String opedInfo, String remark);

    /**
     * 注册(公司类型)接口，包括初始管理员账号，账号必须为手机
     *
     * @param party
     * @param company
     * @param user
     */
    public void registerPartyCompany(UserParty party, UserPartyCompany company, UserBasic user) throws ViChatException;


    public void registerAgentCompany(AgentUser user, AgentCompany company) throws ViChatException;

    public List<AgentCompany> queryAgentCompany(AgentUser user, AgentCompany company, PageFilter pf) throws Exception;

    public long countAgentCompany(AgentUser user, AgentCompany company) throws Exception;

    public AgentUser getAgentUserByAgentId(long agentId, long userType);

    public AgentUser getAgentUserByUid(long uid);

    public AgentCompany getAgentCompanyByAgentId(long agentId);

    public void saveAgentCompany(AgentCompany company);

    public AgentUser ccsChgAgentUserPass(long uid, String newPassWord);
    public CcsUser ccsChgCcsUserPass(long uid, String newPassWord);

    public List<AgentUser> queryAgentUsers(AgentUser user, PageFilter pf) throws Exception;

    public Long countAgentUsers(AgentUser user) throws Exception;

    public AgentUser saveAgentUser(AgentUser agentUser) throws ViChatException;

    public AgentUser getAgentUserByAccount(String account);

    public Map<String, List<AgentUser>> batchUpdateAgentUser(List<AgentUser> user);

    public Map<String, List<AgentUser>> batchCreateAgentUser(List<AgentUser> users);

    public void updateExpiredDate(CcsUser sessionUser, AgentCompany companyFDB, Integer monthNumber, String record) throws ViChatException;

    public void updateUserExpiredDate(CcsUser sessionUser, UserBasic userBasic, Integer monthNumber) throws ViChatException;

    public void updateCompanyExpiredDate(CcsUser sessionUser, UserPartyCompany companyOut, Integer monthNumber, String remark) throws ViChatException;


    /**
     * 获取人员总览
     *
     * @return
     */
    public CcsUserOnlineVO getUserOnlineView() throws Exception;

    public List<RechargeRecord> queryRechargeRecord(RechargeRecord rechargeRecord, PageFilter pageFilter) throws Exception;

    public long countRechargeRecord(RechargeRecord rechargeRecord) throws Exception;

    public void setRechargeRecordRemark(long logId, String remark) throws ViChatException;

    public List<AgentUseVO> queryAgentCompanyShort(String name, Long parentId, PageFilter pageFilter) throws ViChatException;

    public List<UserPartyCompany> queryUserPartyCompanyShort(String name, long agentId, PageFilter pageFilter) throws ViChatException;

    public List<UserBasic> queryUserBasicShort(String name, long partyId, PageFilter pageFilter) throws ViChatException;

    public void assginSN(List<SnResource> snResourceList, Long agentId) throws ViChatException;

    public SnResource querySnResourceBySN(String sn);

    public SnResource queryNotAssignSnResourceBySN(String sn);

    public SnResource saveSnResource(SnResource snResource) throws ViChatException;

    public Map<String, List<SnResource>> batchSaveSnResources(List<SnResource> snResourceList) throws ViChatException;

    public List<SnResource> querySnResource(SnResource snResource, PageFilter pageFilter);

    public SnResource querySnResourceBySnId(long snId);

    public long countSnResource(SnResource snResource);

    public void delSnResource(SnResource snResource);

    public void deleteAgent(long agentId);

    public void deleteAgentUser(Long agentUid) throws ViChatException;

    public void deleteCcsUser(Long ccsUid) throws ViChatException;

    public CcsUser saveCcsUser(CcsUser ccsUser)throws ViChatException;

    public void saveAppVersionFile(AppVersionFile file);
    public void startVersionFile(long fileId);

    public List<AppVersionFile> queryAppVersionFile(AppVersionFile file,PageFilter pageFilter);
    public long countAppVersionFile(AppVersionFile file);
    public AppVersionFile getAppVersionFileByFileId(long fileId);
    public AppVersionFile getAppVersionFileByVersionCode(long versionCode,String pkgName);
    public AppVersionFile getStartAppVersionFileByPkgName(String pkgName);
    public void updateStartedVersionFileByPkgName(String pkgName);
    public void delAppVersionFile(long fileId);
}
